<script>
  import $ from 'dfish-widget'
  import Method from '../Method.vue'

  export default {
    mixins: [Method],
    data() {
      return {
        name: '$.strHighlight(str, key, [matchLength], [keyClass])',
        remark: '给字串中的关键词加上高亮的样式标签。',
        attrs: [{
          name: 'str',
          remark: '字符串',
          type: 'String',
        },{
          name: 'key',
          remark: '关键词',
          type: 'String',
        },{
          name: 'matchLength',
          remark: '切词长度',
          type: 'Number',
        },{
          name: 'keyClass',
          remark: '高亮的样式名。默认值为"f-keyword"。',
          type: 'String',
          default: 'f-keyword'
        }],
        examples: [{
          remark: '给字符串中的"福州"加上高亮标签',
          code: `
            let s = $.strHighlight('福建省福州市', '福州'); // 返回 "福建省<em class=f-keyword>福州</em>市"
            `
        }]
      }
    }
  }
</script>
